Skip to content

Conversation

@joshheald
Copy link
Contributor

@joshheald joshheald commented Nov 5, 2025

Description

This PR updates our network requests for full syncs to respect the setting for whether to use cellular data or not.

  • First sync will always use cellular, regardless of the toggle.
  • Subsequent full syncs will fail if the toggle is set to off, and there's no wifi.
  • Incremental syncs are not affected by the setting.

The PR works for both the paginated endpoint approach, and the file download endpoint (which is feature flagged)

Test Steps

Testing is a little fiddly if you don't have an iPad with cellular (which I don't.) You can't test on a simulator

To handle this, I used my iPhone Pro Max, which can show POS if you change the POSTabVisibilityChecker.checkVisibility() function to remove the guard userInterfaceIdiom == .pad check.

Paginated endpoint API

  1. Disable wifi
  2. Log out and log back in again
  3. Observe that the first sync works as expected
  4. Navigate to POS settings > Catalog
  5. Tap Refresh Catalog
  6. Observe that the sync does not complete and errors are logged in the console mentioning cellular. We don't show these in the UI

File catalog API

When testing with the file-based catalog API, you'll need to enable the pointOfSaleCatalogAPI feature flag.
It's also helpful to update POSCatalogSyncCoordinator.performFullSyncIfApplicable(for:maxAge:regenerateCatalog:) to stop it constantly regenerating the catalog. This isn't essential, but can help speed up testing with large sites.

    fullSyncService.startFullSync(for: siteID,
                                                        regenerateCatalog: false,
                                                        allowCellular: allowCellular)

If you use the larger test stores, you'll also need to update the POSLocalCatalogEligibilityService.Constants.defaultCatalogSizeLimit to 100000 so that it's deemed eligible for local catalog.

  1. Disable wifi
  2. Log out and log back in again
  3. Switch to a store which supports local catalog (e.g. largefuntesting.mystagingwebsite.com)
  4. Observe that the first sync works as expected
  5. Navigate to POS settings > Catalog
  6. Tap Refresh Catalog
  7. Observe that the sync does not complete and errors are logged in the console mentioning cellular. We don't show these in the UI

Tests performed

  • First sync uses cellular on file endpoint with Dotcom login
  • First sync uses cellular on file endpoint with site credentials login
  • First sync uses cellular on legacy endpoints with Dotcom login
  • First sync uses cellular on legacy endpoints with site credentials login
  • Full sync does not use cellular cellular on file endpoint with Dotcom login when toggle off
  • Full sync does not use cellular on file endpoint with site credentials login when toggle off
  • Full sync does not use cellular on legacy endpoints with Dotcom login when toggle off
  • Full sync does not use cellular on legacy endpoints with site credentials login when toggle off
  • Full sync uses cellular on file endpoint with Dotcom login when toggle off
  • Full sync uses cellular on file endpoint with site credentials login when toggle off
  • Full sync uses cellular on legacy endpoints with Dotcom login when toggle off
  • Full sync uses cellular on legacy endpoints with site credentials login when toggle off

Note that errors are not shown when the sync fails for this reason, generally speaking, because sync happens as a non-user process. We could show errors when it fails on tapping Refresh catalog, since that's user invoked, but I see that as outside the scope of this PR.


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@joshheald joshheald added this to the 23.7 milestone Nov 5, 2025
@joshheald joshheald added type: task An internally driven task. feature: POS labels Nov 5, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 5, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16320-4b644ab
Version23.6
Bundle IDcom.automattic.alpha.woocommerce
Commit4b644ab
Installation URL5uo2dkcmtlkc0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@joshheald joshheald marked this pull request as ready for review November 5, 2025 13:55
@iamgabrielma iamgabrielma self-assigned this Nov 6, 2025
Copy link
Contributor

@iamgabrielma iamgabrielma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well! Tested on iPhone 14 by disabling the .pad constraint for the paginated endpoint approach. Could you invite me to some large store (largefuntesting.mystagingwebsite.com or other) so I can give it a go to the file-based catalog API?

🚢

}
let request = URLRequest(url: url)
var request = URLRequest(url: url)
request.allowsCellularAccess = allowCellular
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL: allowsCellularAccess property in the URLRequest

@joshheald
Copy link
Contributor Author

Thanks for the review!

Could you invite me to some large store (largefuntesting.mystagingwebsite.com or other) so I can give it a go to the file-based catalog API?

Sorry, should have checked you had that when I made this PR. Invited you now.

@joshheald joshheald merged commit eeccb43 into trunk Nov 6, 2025
14 checks passed
@joshheald joshheald deleted the woomob-1335-woo-poslocal-catalog-use-cellular-data-setting-for-sync branch November 6, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants